﻿<localControls:ImprovedChildWindow 
	x:Class="Toon.Dialogs.ShitckPicker"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
	xmlns:localControls="clr-namespace:Toon.Controls"
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:converters="clr-namespace:Granite.Xaml.Converters;assembly=Granite.Xaml"
	Width="700" Height="450" 
	x:Name="Top"							  
	Title="Shitcks">
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <StackPanel Margin="5" Grid.Column="0">
                <TextBlock FontSize="20" Text="Catalog" />
            </StackPanel>

            <ScrollViewer Grid.Row="1">
                <ItemsControl  ItemsSource="{Binding Catalog.Shitcks}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <localControls:DetailRegion Command="{StaticResource AddShitck}" CommandParameter="{Binding}" >
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Name}" />
                                    <TextBlock Text=" (" />
                                    <TextBlock Text="{Binding BaseCost}" />
                                    <TextBlock Text=")" />
                                </StackPanel>
                            </localControls:DetailRegion>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>


            <toolkit:DockPanel Margin="5" Grid.Column="1" LastChildFill="False">
                <TextBlock FontSize="20" Text="Shitcks" VerticalAlignment="Center" HorizontalAlignment="Center" toolkit:DockPanel.Dock="Left" />
                <Button Content="New" Command="{StaticResource NewShitck}" VerticalAlignment="Center"  toolkit:DockPanel.Dock="Right"/>
            </toolkit:DockPanel>

            <ItemsControl Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Shitcks}"  >
                <ItemsControl.Template>
                    <ControlTemplate>
                        <ScrollViewer>
                            <ItemsPresenter />
                        </ScrollViewer>
                    </ControlTemplate>
                </ItemsControl.Template>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <!-- TODO: Redo the layout for this control -->
                        <Border BorderBrush="Black" BorderThickness="2" Padding="2">
                            <StackPanel>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>

                                    <TextBox Margin="4" Text="{Binding Name, Mode=TwoWay}" Grid.ColumnSpan="3" />

                                    <CheckBox Margin="4" Content="Usable on others" Grid.Column="3" IsChecked="{Binding UsableOnOthers, Mode=TwoWay}" />

                                    <Button VerticalAlignment="Center" HorizontalAlignment="Center" Width="20" Height="20" Margin="4" Content="-" Command="{StaticResource RemoveShitck}" CommandParameter="{Binding}" Grid.Column="4"/>

                                    <TextBlock Margin="4" Text="Notes" Grid.Row="1" 
                                       Visibility="{Binding IsChecked, ElementName=ShowNotes, Converter={StaticResource TrueToVisibleConverter}}"/>
                                    <TextBox Margin="4" Text="{Binding Notes, Mode=TwoWay}" AcceptsReturn="True" Grid.Row="1" Grid.Column="1" Height="50" Grid.ColumnSpan="3" />


                                </Grid>

                                <Grid>
                                    <Grid.Resources>
                                        <Style TargetType="TextBlock">
                                            <Setter Property="FontSize" Value="14" />
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="25" />
                                        <ColumnDefinition Width="20" />
                                        <ColumnDefinition Width="25" />
                                    </Grid.ColumnDefinitions>

                                    <TextBlock VerticalAlignment="Center" Text="Personalized Cost" Margin="0,0,5,0" Grid.Column="0" />

                                    <Button Visibility="{Binding SkillPoints, Converter={StaticResource MinusVisibility}}" Content="-" Margin="4" CommandParameter="{Binding}" Command="{StaticResource MinusCommand}" Grid.Column="1" />

                                    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding SkillPoints}" Grid.Column="2"/>

                                    <Button Content="+" Margin="4" CommandParameter="{Binding}" Command="{StaticResource PlusCommand}" Grid.Column="3" />

                                </Grid>
                            </StackPanel>
                        </Border>

                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

        </Grid>

        <Button Name="OKButton" Content="Close" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Center" Grid.Row="1" />
    </Grid>
</localControls:ImprovedChildWindow>
	